package cn.sylinx.common.lang;

import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;

public class HttpUtils {

    public static InputStream returnBitMap(String path) {

        URL url = null;
        InputStream is = null;

        try {
            url = new URL(path);

        } catch (MalformedURLException e) {
            e.printStackTrace();
        }

        try {
            HttpURLConnection conn = (HttpURLConnection) url.openConnection();// 利用HttpURLConnection对象,我们可以从网络中获取网页数据.
            is = url.openStream();
            
            if (conn.getResponseMessage().equals("OK")) {
                return is;
            }

        } catch (Exception e) {
            e.printStackTrace();
        }

        return is;
    }
}
